
import 'package:json_annotation/json_annotation.dart';

@JsonSerializable()
class ApiEndPoint {
    String url;
    String method;
    Map<String, String>? headers;
    ApiEndPoint(
        this.url,
        this.method,
        this.headers
    );

    factory ApiEndPoint.fromJson(Map<String, dynamic> json) {
        return ApiEndPoint(
            json['url'] as String,
            json['method'] as String,
            (json['headers'] as Map<String, dynamic>?)?.map((k, v) => MapEntry(k, v as String))
        );
    }
    Map<String, dynamic> toJson() => {
        'url': url,
        'method': method,
        'headers': headers
    };
}